<template>
	<view style="padding-bottom: 120rpx;">
		<u-navbar v-if="!$isWeixin()" :title="title" :title-width="450" :titleBold="true" :background="{ backgroundColor: '#ffffff' }" :is-fixed="true"></u-navbar>

		<u-tabs active-color="#FF7A23" :list="tabList" :current="tabIndex" @change="index => (tabIndex = index)"></u-tabs>

		<view v-if="tabIndex === 0"><relations :list="state.This_Dealer_RelationList"></relations></view>

		<view class="" v-if="tabIndex === 1">
			<door-costs-information :data="state.DoorApplyInfo"></door-costs-information>
			<u-cell-item title="协议" :arrow="false" style="padding-bottom: 0;" :border-bottom="false"></u-cell-item>
			<u-cell-item :arrow="false" style="padding: 10rpx;"><image-upload :readonly="true" :value="state.AgreementPhotoList"></image-upload></u-cell-item>
		</view>

		<view class="" v-if="tabIndex === 2">
			<u-cell-item :arrow="false" style="padding: 10rpx;" v-if="state.AgreementPhotoList.filter(item => item.TypeId == 1).length > 0">
				<image-upload :readonly="true" :value="state.AgreementPhotoList.filter(item => item.TypeId == 1)"></image-upload>
			</u-cell-item>
			<u-cell-item :arrow="false" style="padding: 10rpx;"><file-picker :readonly="true" :value="state.AgreementPhotoList.filter(item => item.TypeId == 4)"></file-picker></u-cell-item>
		</view>

		<view class="" v-show="tabIndex === 3"><agreement-review :data="state.Door_AgreementInfo"></agreement-review></view>

		<view class="btn-group-fixed"><u-button @tap="backToList">返回列表</u-button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title: '门头协议验收审核详情',
			tabList: [{ name: '销售业务关系' }, { name: '门头信息' }, { name: '协议信息' }, { name: '验收审核信息' }],
			tabIndex: 0,

			AgreementAcceptanceId: 18,
			ApplyType: 1,

			state: {
				AgreementPhotoList: [],
				DoorApplyInfo: {},
				Door_AgreementInfo: {},
				Door_Dealer_BaseInfo: {},
				Double_Dealer_BaseInfo: {},
				First_Dealer_BaseInfo: {},
				RealList: [],
				ShowLevel: '',
				This_Dealer_OtherInfo: {},
				This_Dealer_RelationList: []
			}
		};
	},

	onLoad(options) {
		if (options.AgreementAcceptanceId) {
			this.AgreementAcceptanceId = options.AgreementAcceptanceId;
		}
		this.init();
		if (this.$isWeixin()) {
			this.$setTitle(this.title);
		}
	},
	methods: {
		backToList() {
			uni.navigateBack()
		},
		init() {
			this.$u.api
				.getDoorDesignReviewDetail({
					AgreementAcceptanceId: this.AgreementAcceptanceId,
					ApplyType: 1,
				})
				.then(res => {
					console.log(res);

					const { ResultCode, ResultData, ResultMessage } = res;
					if (ResultCode === 1) {
						this.state = ResultData;
						
						this.state.Door_AgreementInfo.AuditForList = ResultData.AuditForList;
					}
				});
		}
	}
};
</script>

<style></style>
